home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 1 (Walnut Creek)
/
Aminet - June 1993 [Walnut Creek].iso
/
aminet
/
mus
/
midi
/
midiwatcher.lha
/
midiwatcher.doc
< prev
next >
Wrap
Text File
|
1993-02-12
|
8KB
|
161 lines
============================================================================
MidiWatcher v1.0 by Ed Mackey
============================================================================
Yes folx, another one of my silly trinkets appears on the net ;-).
MidiWatcher is for people with MIDI keyboards. It requires the midi.library
v2 or higher by Bill Barton (not included). It should run under almost any
version of the Amiga's OS.
Basically, this program sits in the background and watches your MIDI IN port
for certain tunes. When it recognizes a tune, it runs a program.
For instance, if I need my directory utility up, I can do one of three
things: (1) I can search through subdirectories for its icon (takes too
much time and is boring), (2) I can press a ToolManager hotkey (takes much
less time but is still boring), or (3) I can reach over and play a little
jingle on my MIDI keyboard, and up pops MegaD. The third choice is clearly
much more fun than either of the others ;-).
This program should be run from the CLI. I suppose it would also run from
Workbench if you did not need to pass any parameters to it. Personally,
I recommend putting it in your user-startup file. If you type
midiwatcher ?
you will see:
MidiWatcher by Ed Mackey. Watch MIDI keyboard for tunes.
Usage: midiwatcher [-i source] [-f savefile] [-r] [-d]
-i selects a MidiIn source, defaults to MidiIn
-f selects a tune save file, defaults to S:midiwatch
-r turns on RECORD mode and adds a tune to file -f
-d turns on DEBUG mode (playback only) to see your tunes go.
Here is a more complete description of the options:
Well actually, -i is already described as much as it needs to be. See the
DOCs for midi.library to learn more about MIDI sources. Note that ALL 16
channels of your MIDI source will be monitored as if they were all one
channel. I realize this is somewhat uncool for some people, but remember
this program is only a trinket. You can also filter out MIDI channels with
a midi.library patch bay type program. Send me email if you want this
changed.
-f selects a filename for the database of tunes to be recognized. See -r
-d is DEBUG mode, so you can watch MidiWatcher trying to recognize tunes.
-r puts MidiWatcher in RECORD mode. When in this mode, MidiWatcher saves
every note it sees until you press CTRL-C. It then writes to the savefile
something that looks like this:
# Your comments go here (such as name of tune)...
$3c 37 36 37 38 37 3b 3c
@PLAY
*id midi_event
>echo "Tune recognized"
Only, you know, flush left because it is not in a DOC file. :-)
The save file will be appended to if it already exists, and created
otherwise. You should then edit this file with a text editor. Here is
what the lines mean:
# is a comment line. Just write the name of the tune or whatever here.
$ has some hex numbers which you should not change. These are the note
numbers extracted from MIDI NoteOn messages during your recording. Note
there is no tempo or chord information here, just a sequence of NoteOns.
I don't recommend playing chords unless you can start the individual
notes of the chord in a certain order all the time. I told you this
program was a trinket, didn't I?
@ This is an optional line for people with ARexx. It specifies an ARexx
port, and as you know, ARexx port names are case-sensitive.
* This is an optional line for people with ARexx. It contains a string
to send as an ARexx message to the port named by the @ line. Note that
both the @ and * lines must be included for either to have an effect.
People without ARexx should delete all @ and * lines.
When a tune with an ARexx message is recognized, the message is prepared
and sent. MidiWatcher then continues normal processing _without_ waiting
for the message to return. However, if you send MidiWatcher a CTRL-C
or a QUIT command (explained later), MidiWatcher will wait for all sent
ARexx messages to return before quitting.
> This line specifies a CLI command to execute. This line can be omitted
only if both the @ and * lines are present and no CLI command is needed.
Note that unlike ARexx messages, the CLI command will prevent MidiWatcher
from running until the command's completion. This should always be
avoided like this:
>run <NIL: >NIL: (your path & program name here)
This use of the "run" command will make sure that MidiWatcher can keep
multitasking with your newly-started program.
Note that if both an ARexx message and a CLI command are specified for
a given tune, the ARexx message will be sent first, and the CLI command
will be executed immediately after the message is sent. As you can see
from the example, I use this with Upd to play sound effects and launch
programs at the same time, each time a tune is recognized.
============================================================================
The ARexx Port
============================================================================
Aha. Not expecting that one were you?
Well, this program has an ARexx port of it's own, called MIDIWATCHER.
It currently understands three commands, and these commands must
always appear in UPPER CASE (sorry guys):
SUSPEND - Release the MidiIn (and hence the serial port, unless some
other program is using MIDI), and just sit in the
background until further notice. Returning ARexx messages
sent by tunes are still freed. If MidiWatcher was already
in suspend mode, this command is ignored.
RESUME - Leave SUSPEND mode if MidiWatcher was in it. MIDI and your
serial port are again tied up.
QUIT - Same as sending MidiWatcher's CLI process a CTRL-C.
Deallocates MIDI, waits for any ARexx messages sent by
tunes to come home, and exits (in that order ;-).
Should work even in SUSPEND mode (I hope).
This ARexx port is of course not opened if you do not have ARexx (I know
this sounds silly, but some programs let you use ARexx ports without
having ARexx. MidiWatcher is not one of these programs).
This port is also NOT available in RECORD [-r] mode (it's not needed then).
I suppose you could have a tune that caused MidiWatcher to send an ARexx
message to itself. This would not cause a problem (but of course a
RESUME message would be useless, as MidiWatcher could not be in SUSPEND
mode in the first place if it was sending messages).
NOTE: If the serial port is not available to midi.library when
MidiWatcher is run or when MidiWatcher receives a RESUME
command, MidiWatcher will have a cow and act like you pushed
CTRL-C. I suppose I should fix this.... nah....
Anyway, I added this ARexx port as an afterthought, so that I could have
my terminal program use SUSPEND to grab the serial port and RESUME when
it was done.
============================================================================
Have fun with your new trinket. Don't take this program too seriously,
I only wrote it because I needed a short break from my senior project.
I disclaim responsibility for any blah blah blah whatever.
If you like this program send me money blah blah blah whatever.
Have fun!!
--Ed.
Ed Mackey BBS: Somerton Telecomm II, (215) 464-6775
PO Box 475 IRC: LineNoise
Wayne, PA 19087 Internet email: elm4@lehigh.edu